<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
/*
	选择商品modal，通过访问此页面选择获取指定商品id
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
	//商品列表
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$return['params']=$params=array();
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1);
	$fields=array('title');
	if($_RQ['find']){
		$field=in_array($_RQ['field'],$fields)?$_RQ['field']:'title';
		$params[$field.' like']='%'.$_RQ['find'].'%';
		$return['params']['find']=$_RQ['find'];
		$return['params']['field']=$field;
	}
	$list=pdo_getslice('jy_weishop_store',$params,array($pindex,$psize),$total,array('id','logo','title'),'','id desc');
	if($list){
		foreach($list as &$item){
			if($_RQ['op']=='many'){
				$item['res']=array(
					'title'=>$item['title'],
					'id'=>$item['id'],
					'image'=>$item['logo']?$item['logo']:'../core/resource/images/nopic.jpg',
				);
			}else{
				$item['res']=$item['id'];
			}
			
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$return['htmls']=array(
			'type'=>'list',
			'tabs'=>array(
				array('op'=>'list','title'=>'门店列表'),
			),
			'list'=>array('data'=>'list','del_one'=>false,'delall'=>false,'edit'=>false,'list'=>array(
				array('name'=>'id','title'=>'门店id','type'=>'string'),
				array('name'=>'title','title'=>'门店名称','type'=>'string'),
				array('name'=>'logo','title'=>'门店logo','type'=>'image'),
			),'action'=>array(
				array('type'=>'modal_result','name'=>'res','title_field'=>'title','title'=>'选取'),
			)),
			'search_one'=>array('name'=>'find','select_name'=>'field','select_title'=>'筛选','is_radio'=>true,'options'=>'fields'),
	);
	$return['fields']=array(
		'title'=>'门店名称',
		
	);
	exi($return);

?>